using UnityEngine;
using System.Collections;

public class Lives : MonoBehaviour {
GameObject Life1; //One Life Left
GameObject Life2; //Two Lives
GameObject Life3; //Full Health
 static int Health = 3;
	
	// Use this for initialization
	void Start () 
	{
	
	}
	
	// Update is called once per frame
	void Update () 
	{
		GameObject.FindGameObjectWithTag("diamond");
	}
	public void RemoveLife()
    {
        --Health;
        if (Health < 1)
        {
            Application.LoadLevel("MainScene");
        }

        switch (Health)
        {
            case 3:
			Life1 = Life1.gameObject;
			Destroy(Life1.gameObject);
			RemoveLife();
            break;

            case 2:
			Life2 = Life2.gameObject;
			Destroy(Life2.gameObject);
			RemoveLife();
            break;

            case 1:
			Life3 = Life3.gameObject;
			Destroy(Life3.gameObject);
			RemoveLife();
            break;
        }


		  
	}
}